package com.cimp.service.c2.server;

import java.io.Serializable;

import javax.xml.namespace.QName;

import org.apache.axis.description.ElementDesc;
import org.apache.axis.description.TypeDesc;
import org.apache.axis.encoding.Deserializer;
import org.apache.axis.encoding.Serializer;
import org.apache.axis.encoding.ser.BeanDeserializer;
import org.apache.axis.encoding.ser.BeanSerializer;



/**
 * 
 * [简要描述]:<br/>
 * [详细描述]:<br/>
 *
 * @version [revision],Aug 29, 2012
 * @since IPTV CMS V100R003C01B630
 */
public class CSPResult implements Serializable
{
    /**
     * 序列化
     */
    private static final long serialVersionUID = 3832992443858524512L;
    
    private static TypeDesc typeDesc = new TypeDesc(CSPResult.class, true);
    
    private int result;

    private String errorDescription;

    private Object equalsCalc = null;

    private boolean hashCodeCalc = false;

    static
    {
        typeDesc.setXmlType(new QName("iptv", "CSPResult"));
        ElementDesc elemField = new ElementDesc();
        elemField.setFieldName("result");
        elemField.setXmlName(new QName("", "Result"));
        elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "int"));
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new ElementDesc();
        elemField.setFieldName("errorDescription");
        elemField.setXmlName(new QName("", "ErrorDescription"));
        elemField.setXmlType(new QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
        elemField.setNillable(true);
        typeDesc.addFieldDesc(elemField);
    }

    /**
     * 
     * [简要描述]:<br/>
     * [详细描述]:<br/>
     *
     */
    public CSPResult()
    {
    }

    /**
     * 
     * [简要描述]:<br/>
     * [详细描述]:<br/>
     *
     * @param result int
     * @param errorDescription String
     */
    public CSPResult(int result, String errorDescription)
    {
        this.result = result;
        this.errorDescription = errorDescription;
    }

    public int getResult()
    {
        return this.result;
    }

    public void setResult(int result)
    {
        this.result = result;
    }

    public void setErrorDescription(String errorDescription)
    {
        this.errorDescription = errorDescription;
    }

    public String getErrorDescription()
    {
        return this.errorDescription;
    }

    /**
     * 
     * [简要描述]:<br/>
     * [详细描述]:<br/>
     * 
     * @param obj Object
     * @return boolean
     * @exception 
     * @see Object#equals(Object)
     */
    public synchronized boolean equals(Object obj)
    {
        if (null == obj)
        {
            return false;
        }
        if (!(obj instanceof CSPResult))
        {
            return false;
        }
        CSPResult other = (CSPResult) obj;
        if (this == obj)
        {
            return true; 
        }
        if (null != this.equalsCalc)
        {
            return this.equalsCalc == obj;
        }
        this.equalsCalc = obj;

        boolean equals = (this.result == other.getResult())
                && (((null == this.errorDescription) && (null == other.getErrorDescription())) 
                        || ((null != this.errorDescription) 
                                && (this.errorDescription.equals(other.getErrorDescription()))));
        this.equalsCalc = null;
        return equals;
    }


    public static TypeDesc getTypeDesc()
    {
        return typeDesc;
    }

    /**
     * 
     * [简要描述]:<br/>
     * [详细描述]:<br/>
     * 
     * @param mechType String
     * @param javaType Class
     * @param xmlType QName
     * @return Serializer
     * @exception
     */
    public static Serializer getSerializer(String mechType, Class javaType, QName xmlType)
    {
        return new BeanSerializer(javaType, xmlType, typeDesc);
    }

    /**
     * 
     * [简要描述]:<br/>
     * [详细描述]:<br/>
     * 
     * @param mechType String
     * @param javaType Class
     * @param xmlType QName
     * @return Deserializer
     * @exception
     */
    public static Deserializer getDeserializer(String mechType, Class javaType, QName xmlType)
    {
        return new BeanDeserializer(javaType, xmlType, typeDesc);
    }
}
